import shutil
import os
import pytest

from tool.get_log import GetLogging

REPORT_DIR = "./reports"
logger = GetLogging().get_logging()


@pytest.fixture(scope="session", autouse=True)
def clear_report_dir_before_session():
    if os.path.exists(REPORT_DIR):
        shutil.rmtree(REPORT_DIR)
        logger.info(f"\n已清空旧报告目录：{REPORT_DIR}")
    os.makedirs(REPORT_DIR, exist_ok=True)
    logger.info(f"已创建新报告目录：{REPORT_DIR}\n")
